package IC.SymbolTables.Types;

public class BasicType extends InstanceType
{
	private BasicTypeEnum _type;
	
	public BasicType(BasicTypeEnum type) { _type = type; }
	
	public boolean IsInstanceOf(Type type)
	{
		return (type instanceof BasicType) && _type.equals(((BasicType)type)._type);
	}
	
	public boolean equals(BasicTypeEnum type) { return _type.equals(type); }
	
	public String toString() { return _type.toString(); }
	
	public enum BasicTypeEnum
	{
		INT (0, "int"),
		BOOL (1, "boolean"),
		STRING (2, "string");
		
		private int _identifier;
		private String _stringIdentifier;
		
		private BasicTypeEnum (int identifier, String stringIdentifier)
		{
			_identifier = identifier;
			_stringIdentifier = stringIdentifier;
		}
		
		public boolean equals(BasicTypeEnum other) { return other._identifier == _identifier; }
		
		public String toString() { return _stringIdentifier; }
	}
}
